/** 
 * @author: zxb
 * @date: 2024-07-25 
 * @Description: 路由入口
 * @des 全局路由加载
*/

const fs = require('fs')
const Router = require('koa-router')
// const router = new Router()
const router = new Router({ prefix: '/api' }) //带有api前缀的接口

fs.readdirSync(__dirname).forEach((item) => {
    if (item !== 'index.js') {
        const r = require(`./${item}`)
        router.use(r.routes())
    }
})
console.log("数据库加载成功!")
module.exports = router

